package com.xinyuan.trade.Activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.DisplayMetrics;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.xinyuan.trade.Adaptive.UIAdapter;

/**
 * Activity基类
 * @author daiy
 *
 */
public abstract class BaseActivity extends FragmentActivity {

	protected ImageLoader imageLoader = ImageLoader.getInstance();
	
	protected BaseActivity self;
	protected UIAdapter uiAdapter;
	protected int width ,height;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		self = this;
		uiAdapter = UIAdapter.getInstance(self);
		
		DisplayMetrics dm = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(dm);
		width = dm.widthPixels;
		height = dm.heightPixels;
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
		imageLoader.clearMemoryCache();
	}

	public UIAdapter getUiAdapter() {
		return uiAdapter;
	}

	public void setUiAdapter(UIAdapter uiAdapter) {
		this.uiAdapter = uiAdapter;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}
}
